﻿using System;
using System.Collections.Generic;
using System.Text;
using HyEduOnline.Entities;
using HyEduOnline.Data;


namespace HyEduOnline.Server.Teacher
{
	
	
	
			//Item.Id			////描述:,数据类型:Int32
		//Item.SCourseCode			////描述:,数据类型:AnsiString
		//Item.SCourseName			////描述:,数据类型:AnsiString
		//Item.IPartId			////描述:,数据类型:Int32
		//Item.SPartName			////描述:,数据类型:AnsiString
		//Item.SIntro			////描述:,数据类型:AnsiString
		//Item.ILevel			////描述:,数据类型:Int32
		//Item.SImgUrl			////描述:,数据类型:AnsiString
		//Item.SKeyWord			////描述:,数据类型:AnsiString
		//Item.IHardLevel			////描述:,数据类型:Int32
		//Item.IHours			////描述:,数据类型:Int32
		//Item.IRelationId			////描述:,数据类型:Int32
		//Item.IType			////描述:,数据类型:Int32
		//Item.SLanguage			////描述:,数据类型:AnsiString
		//Item.STeacherCode			////描述:,数据类型:AnsiString
		//Item.STeacherName			////描述:,数据类型:AnsiString
		//Item.STemp1			////描述:,数据类型:AnsiString
		//Item.STemp2			////描述:,数据类型:AnsiString
//---Begin-开始生成Ext Grid的模板 
//<asp:ObjectDataSource ID="odsDeanCourse" runat="server" SelectMethod="GetByPageVW" 
//	TypeName="HyEduOnline.Web.DeanCourse" OnSelected="odsDeanCourse_Selected" DeleteMethod="Del" UpdateMethod="Update"> 
// <SelectParameters> 
//<asp:SessionParameter Name="whereClause" SessionField="whereClause" Type="String" /> 
//<asp:Parameter Name="start" Type="Int32" /> 
//<asp:Parameter Name="limit" Type="Int32" /> 
//<asp:Parameter Name="sort" Type="String" /> 
//<asp:Parameter Name="dir" Type="String" /> 
//<asp:Parameter Name="count" Direction="Output" Type="Int32" /> 
// </SelectParameters> 
//<DeleteParameters> 
//<asp:Parameter Name="id" Type="Int32" /> 
//</DeleteParameters> 
//</asp:ObjectDataSource> 
//<ext:Store ID="storeDeanCourse" runat="server" AutoLoad="true" RemoteSort="true" DataSourceID="odsDeanCourse" OnRefreshData="storeDeanCourse_RefreshData" EnableViewState="false"> 
//<AutoLoadParams> 
//<ext:Parameter Name="start" Value="={0}" /> 
//<ext:Parameter Name="limit" Value="={10}" /> 
//</AutoLoadParams> 
//<Proxy> 
//<ext:DataSourceProxy /> 
//</Proxy> 
//<Reader> 
//<ext:JsonReader > 
//<Fields> 
		//<ext:RecordField Name="Id" />  
		//<ext:RecordField Name="SCourseCode" />  
		//<ext:RecordField Name="SCourseName" />  
		//<ext:RecordField Name="IPartId" />  
		//<ext:RecordField Name="SPartName" />  
		//<ext:RecordField Name="SIntro" />  
		//<ext:RecordField Name="ILevel" />  
		//<ext:RecordField Name="SImgUrl" />  
		//<ext:RecordField Name="SKeyWord" />  
		//<ext:RecordField Name="IHardLevel" />  
		//<ext:RecordField Name="IHours" />  
		//<ext:RecordField Name="IRelationId" />  
		//<ext:RecordField Name="IType" />  
		//<ext:RecordField Name="SLanguage" />  
		//<ext:RecordField Name="STeacherCode" />  
		//<ext:RecordField Name="STeacherName" />  
		//<ext:RecordField Name="STemp1" />  
		//<ext:RecordField Name="STemp2" />  
//</Fields> 
//</ext:JsonReader> 
//</Reader> 
//  <SortInfo Field="Id" Direction="DESC" />//</ext:Store> 
//<ext:GridPanel runat="server" ID="gpDeanCourse" Title="DeanCourse" Frame="true" StoreID="storeDeanCourse"  Height="300" AutoExpandColumn="Id" EnableViewState="false" TitleCollapse="false" > 
//<TopBar>			
//<ext:Toolbar runat="server" ID="DeanCourseTools">			
//<Items>			
//<ext:ToolbarButton ID="btnDeanCourseAdd" runat="server" Text="新增记录" Icon="add">			
//	<Listeners>		
//	<Click Handler="AddDeanCourse();" />		
//	</Listeners>		
//</ext:ToolbarButton>
// <ext:ToolbarButton ID="btnDeanCourseEdit" runat="server" Text="编辑记录" Icon="bulletedit" Disabled="true">			
//	<Listeners>		
//	<Click Handler="EditDeanCourse(#{gpDeanCourse});" />		
//	</Listeners>		
// </ext:ToolbarButton>			
//	<ext:ToolbarFill runat="server" />		
//	 <ext:ToolbarButton ID="btnDeanCourseDelete" runat="server" Text="删除记录" AutoPostBack="false"   Icon="Delete" Disabled="true">		
//	<Listeners>		
//	<Click Handler="if(confirm('真的要删除此记录吗？')){		
//	#{gpDeanCourse}.deleteSelected();		
//	if (!#{gpDeanCourse}.hasSelection()) {#{btnDeanCourseDelete}.disable();};		
//	#{gpDeanCourse}.save();		
//	return true;}		
//	else{return false;}" />		
//	</Listeners>		
//	</ext:ToolbarButton>		
//	</Items>		
//	</ext:Toolbar>		
//	</TopBar>		
// <columnmodel id="ColumnModel1" runat="server"> 
// <Columns> 
//<ext:Column  Header="" Width="50"  DataIndex="Id"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="SCourseCode"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="SCourseName"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="IPartId"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="SPartName"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="SIntro"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="ILevel"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="SImgUrl"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="SKeyWord"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="IHardLevel"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="IHours"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="IRelationId"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="IType"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="SLanguage"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="STeacherCode"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="STeacherName"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="STemp1"  />	  
//<ext:Column  Header="" Width="50"  DataIndex="STemp2"  />	  
// </Columns> 
//</columnmodel> 
//	<LoadMask ShowMask="true" Msg="装入..." />		
//	<SaveMask ShowMask="true"  Msg="保存..." />		
//<selectionmodel> 
//	<ext:CheckboxSelectionModel>		
//	 <Listeners>		
//	<RowSelect Handler="#{btnDeanCourseDelete}.enable();#{btnDeanCourseEdit}.enable();" />		
//	<RowDeselect Handler="if (!#{gpDeanCourse}.hasSelection()) {#{btnDeanCourseDelete}.disable();#{btnDeanCourseEdit}.disable();}" />		
//	</Listeners>			
//	 </ext:CheckboxSelectionModel>			
//</selectionmodel> 
//<bottombar> 
// <ext:PagingToolBar ID="pbDeanCourse" runat="server" PageSize="10" StoreID="storeDeanCourse"   DisplayInfo="true" DisplayMsg="第{0}- {1}  共{2}条 " EmptyMsg="没有找到数据!" /> 
//</bottombar> 
//<loadmask showmask="true" /> 
//</ext:GridPanel> 
// <script type="text/javascript">    
//  function EditDeanCourse(gv){   
//     var selection = gv.getSelectionModel().getSelections();
//     if(selection[0])alert(selection[0].id);
//     else Ext.Msg.alert('出错提示','您需要选择一个记录，如果选择是多记录,则自动选择中第一记录!);
//    } 
//    </script> 
//     
//     
//     
//     
//     
//     
//     

	
	/// <summary>
	///		此用于处理视图对象 'Vw_DeanCourse' 
	/// </summary>
	/// <remarks>
	/// 	此结构由代码由TMS代码生成器书写生成，请不要直接修改.
	///注意:此代码可能和同名的表生成一个完整对象
	/// </remarks>
	public partial class VwDeanCourseBaseDAO 
	{
	
	#region 视图代码
		
		protected int VWTotalCount = -1;
		
		
		/// <summary>
        /// 取所有的对象,例如VList<???>
        /// </summary>
        /// <returns></returns>
		[System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select, true)]
        public  VList<VwDeanCourse> GetVWAll()
        {
            return DataRepository.Provider.VwDeanCourseProvider.GetAll();
        }


        /// <summary>
        /// 条件查询分页
        /// </summary>
        /// <param name="whereClause">条件</param>
        /// <param name="startRowIndex">起始值</param>
        /// <param name="maximumRows">每页的最大值</param>
        /// <returns></returns>
        [System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select, false)]
        public  VList<VwDeanCourse> GetByPageVW(string whereClause, int startRowIndex, int maximumRows)
        {		
			
            return DataRepository.Provider.VwDeanCourseProvider.Get(whereClause, "ID", (int)startRowIndex/maximumRows , maximumRows, out VWTotalCount);

        }
		/// <summary>
		///支持Ext的分页查询,视图
		/// </summary>
        /// <param name="whereClause">查询条件</param>
        /// <param name="start">起始位置</param>
        /// <param name="limit">最大条数</param>
        /// <param name="sort">排序列</param>
        /// <param name="dir">排序方向("DESC","ASC")</param>
        /// <param name="count">取得记录数</param>
        /// <returns>VList<???></returns>
		[System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select, false)]
        public  VList<VwDeanCourse>  GetByPageVW(string whereClause, int start, int limit, string sort, string dir, out int count)
        {
            string sOrder = "";
            if (sort != null && sort != "Id")
            {
                sOrder = sort.Insert(1, "_") + " " + dir;
            }
            else
            {
                if(sort == "Id")sOrder = sort+ " " + dir;
            }
            return DataRepository.Provider.VwDeanCourseProvider.Get(whereClause, sOrder, (int)start / limit, limit, out count);
        }

        /// <summary>
        /// 分页查询计数
        /// </summary>
        /// <param name="whereClause"></param>
        /// <returns></returns>
        [System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select, false)]
        public int GetVWCount(string whereClause, int startRowIndex, int maximumRows)
        {
            if (VWTotalCount != -1)
            {
                return VWTotalCount;
            }
            else
            {
                DataRepository.Provider.VwDeanCourseProvider.GetTotalItems(whereClause, out VWTotalCount);
                return VWTotalCount;
            }
        }
		
		/// <summary>
        /// 更具条件查找
        /// </summary>
        /// <param name="whereClause">需要查找的条件</param>
        /// <returns>VList对象</returns>
		[System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select, false)]
        public VList<VwDeanCourse> GetVWByCondition(string whereClause)
		{
			return GetByPageVW(whereClause,0,int.MaxValue);
		}
		

        /// <summary>
        /// 通过id来取对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public VwDeanCourse GetByVWID(int id)
        {
			
			 VwDeanCourse  Item = null;

            VList<VwDeanCourse> vwList = GetByPageVW("ID=" + id.ToString(), 0, 1);
            if (vwList.Count > 0)
            {
                Item = vwList[0];
            }
            return Item;
            
        }




		#endregion 视图代码

	}
}